// f[i]表示以第i个数为结尾的最大序列长度

#include <iostream>
#include <algorithm>
using namespace std;
const int N = 1010;
int n;
int dp[N], s[N];

int main()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> s[i];
    dp[1] = 1;
    for (int i = 2; i <= n; ++i)
    {
        dp[i] = 1;
        for (int j = 1; j < i; ++j)
            if (s[j] < s[i])
                dp[i] = max(dp[i], dp[j] + 1);
    }
    int res = 0;
    for (int i = 1; i <= n; ++i)
        res = max(res, dp[i]);
    cout << res << endl;
    return 0;
}